package cn.itcast.hotel.controller;

import cn.itcast.hotel.pojo.PageRsult;
import cn.itcast.hotel.pojo.RequestParams;
import cn.itcast.hotel.service.IHotelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/hotel")
public class HotelController {

    @Autowired
    private IHotelService hotelService;

    @PostMapping("/list")
    public PageRsult list(@RequestBody RequestParams params){
        return hotelService.search(params);
    }
    @PostMapping("/filters")
    public Map<String, List<String>> filter(@RequestBody RequestParams params){
        return hotelService.filter(params);
    }
    @GetMapping("/suggestion")
    public List<String> getSuggestion(@RequestParam String key){
        return hotelService.getSuggestion(key);
    }
}
